<script src='//unpkg.com/valine@latest/dist/Valine.min.js'></script>

<div id="vcomments"></div>
<style>
    #vcomments .vcards .vcard {
        background-color: var(--card-background);
	    padding: 25px 25px 5px 25px;
	    border-radius: 3px;
	    margin-bottom: 15px;
	    transition: all .3s
    }

    #vcomments .vcards .vh .vquote .vcard {
	    padding: 10px 25px 0px 0px;
    }

    #vcomments .vcards .vcard .vh .vcard {
        border: none;
        box-shadow: none;
    }

    #vcomments .vcards .vcard .vquote .vimg {
        width: 50px;
        height: 50px;
    }

    #vcomments .vcards .vcard .vimg {
        width: 60px;
        height: 60px;
        float: left;
        border-radius: 5px;
        margin-right: 18px;
        border: 0px;
        padding: 0px;
        box-shadow: 0px 10px 20px rgba(0, 0, 0, 0.04), 0px 2px 6px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.04);
    }

    #vcomments .vcards .vcard .vcontent p{
        font-size: 1.6rem;
        color: var(--card-text-color-main);
    }

    #vcomments .vcards .vcard .vcontent{
        padding-top: 0px;
    }
    
    #vcomments .vcount {
        padding: 0px;
        margin-bottom: 5px;
        margin-top: 20px;
        font-weight: 700;
        font-size: 1.4rem;
        color: var(--body-text-color);
        text-transform: uppercase;
    }

    #vcomments .vwrap .cancel-reply-btn {
        position: relative;
        
    }

    #vcomments .vreply-wrapper .vwrap {
        box-shadow: var(--shadow-l2);
        border: 1px solid rgba(143, 143, 143, 0.3);
        width: 95%;
    }

    #vcomments .vquote .vreply-wrapper .vwrap {
        width: 93%;
    }

    #vcomments .vwrap {
        background-color: var(--card-background);
        border: 0px solid #f0f0f0;
        border-radius: 3px;
        margin-bottom: 10px;
        overflow: hidden;
        position: relative;
        padding: 0px 0px 0px 0px;
        font-family: inherit;
        display: flex;
        flex-direction: column;
    }

    #vcomments .vwrap .cancel-reply {
        position: absolute;
        z-index:999;
        float: right;
        top: -20px;
        right: 0px;
    }

    #vcomments .vwrap .vheader.item3{
        order: 0;
    }

    #vcomments .vwrap .edit{
        order: 1;
    }

    #vcomments .vwrap .vinput.vpreview{
        order: 2;
    }

    #vcomments .vwrap .vemojis{
        order: 3;
    }

    #vcomments .vwrap .vrow{
        order: 4;
    }

    #vcomments .vwrap .vmark{
        order: 5;
    }

    #vcomments .vpanel {
        order: 0;
    }

    #vcomments .vload-top.text-center {
        padding-top: 20px;
        order: 1;
    }

    #vcomments .vcount {
        order: 2;
    }

    #vcomments .vcards {
        order: 3;
    }

    #vcomments .vload-bottom.text-center {
        order: 4;
    }

    #vcomments .vempty {
        order: 5;
    }

    #vcomments .vpage.txt-center {
        order: 6;
    }

    #vcomments .vpower.txt-right {
        order: 7;
    }
    
    #vcomments {
        display: flex;
        flex-direction: column;
    }

    #vcomments .vcards .vcard .vhead .vnick {
        color: var(--accent-color);
        position: relative;
        font-size: 1.6rem;
        font-weight: 700;
        margin-right: .875em;
        cursor: pointer;
        text-decoration: none;
        display: inline-block;
    }
    #vcomments .vcards .vcard .vh .vtime {
        color: var(--card-text-color-secondary);
        font-weight: lighter;
        font-size: 1.3rem;
        margin-right: .875em;
    }

    #vcomments .veditor {
        font-size: 1.6rem;
        color: var(--card-text-color-main);
        padding: 20px;
        max-height: 350px;
        resize: none;
    }
    
    #vcomments .vedit {
        border-bottom: 1px solid rgba(143, 143, 143, 0.3);
        background-color: rgba(255, 255, 255, 0.08);
        padding-top: 0px;
    }    

    #vcomments .vrow {
        padding: 20px;
    }

    #vcomments .vedit .vrow {
        padding: 0px 20px 5px 20px;
    }

    #vcomments .vicon.vemoji-btn {
        fill: var(--card-text-color-tertiary);
    }

    #vcomments .vicon.vpreview-btn {
        display:none !important;
    }

    #vcomments .vwrap .vemojis {
        padding: 20px;
    }

    #vcomments .vquote .vmeta .vat {
        right: 30px;
    }

    #vcomments .vmeta .vat {
        background: 0 0;
        cursor: pointer;
        border: 0;
        border-radius: 5px;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.5);
        transition: box-shadow .3s ease;
        height: 60px;
        width: 60px;
        display: inline-flex;
        justify-content: center;
        align-items: center;
        position: absolute;
        top: -20px;
        right: 10px;
    }

    #vcomments .vmeta .vat svg {
        stroke-width: 1.33;
    }
    
    #vcomments .vmeta .vat:hover {
        outline: 0;
        box-shadow: var(--shadow-l2);
    }

    #vcomments .vheader {
        display: flex;
    }

    #vcomments .vheader p {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        flex: 1;
        position: relative;
        margin: 0;
    }

    #vcomments .vheader label {
        position: absolute;
        top: 10px;
        left: 20px;
        color: var(--card-text-color-tertiary);
        margin-top: -4px;
        font-size: 14px;
    }

    #vcomments .vheader input {
        /* background: var(    --card-background); */
        color: var(--card-text-color-main);
        border: 0;
        background: 0 0;
        padding: 35px 20px 15px;
        width: 100%;
        line-height: 1;
        transition: border .3s ease;
        font-size: 100%;
    }

    #vcomments .vheader p:not(:last-of-type) {
        border-right: 1px solid rgba(143, 143, 143, 0.3);
    }
    

    #vcomments .vh .vhead {
        padding-top: 5px;
    }

    #vcomments .vh .vquote .vhead {
        padding-top: 0px;
    }

    #vcomments .vbtn {
        color: var(--card-text-color-main);
        font-weight: 700;
        font-size: 1.0em;
        border-radius: 3px;
        border-color: 1px solid #666666;
    }

    #vcomments .vmore.vbtn {
        font-size: 13px;
    }

    #vcomments .vbtn:hover {
        color: #bebebe;
        border-color: #707070;
    }

    #vcomments .vbtn:active {
        color: #bebebe;
        border-color: #707070;
    }

    #vcomments .vcards .vcard .vcontent.expand {
        cursor: auto;
        max-height: none;
        overflow: visible;
    }

    #vcomments .vcards .vcard .vcontent.expand::after {
        display:none !important;
    }

    #vcomments .vcards .vcard .vcontent.expand::before {
        
        display:none !important;
    }

    #vcomments .vsys {
        display:none !important;
    }

    #vcomments .vcards .vcard .vh {
        padding-bottom: 0px;
        border-bottom: 0px dashed #f5f5f5;
    }

    #vcomments .vcards .vcard .vquote {
        padding-top: 5px;
        padding-left: 15px;
        border-left: 0px;
        px solid rgba(187, 187, 187, 0.5);
    }

    #vcomments .vicon.actived {
        fill: var(--card-text-color-main);
    }


</style>

<script>
    
    let placeholder = `发表你的评论\n`

    var valine = new Valine();

    valine.init({
        el: '#vcomments',
        appId: '{{ .Site.Params.comments.valine.appId }}',
        appKey: '{{ .Site.Params.comments.valine.appKey }}',
        avatar: '{{ .Site.Params.comments.valine.avatar }}',
        placeholder: placeholder,
        enableQQ: true,
        lang:'{{ .Site.Params.comments.valine.lang }}',
        requiredFields: [],
        recordIP: false,
        visitor: true
    })

    html = `<p><label>昵称（必填）</label><input name='nick' placeholder='张三' class='vnick vinput' type='text'></p>
            <p><label>邮箱</label><input name='mail' placeholder='joe@example.com' class='vmail vinput' type='email'></p>
            <p><label>网址</label><input name='link' placeholder='https://' class='vlink vinput' type='text'></p>`
            
    document.querySelector(".vheader").innerHTML = html
    document.querySelector(".vpower.txt-right").innerHTML = ""

    if(window.location.hash){
        var checkExist = setInterval(function() {
           if (document.getElementById(window.location.hash.substring(1))) {
              document.getElementById(window.location.hash.substring(1)).scrollIntoView({behavior: "smooth", block: "center", inline: "nearest"})
              clearInterval(checkExist);
           }
        }, 100);
    }

</script>
